equal
deleted
inserted
replaced
23 #include <hbmessagebox.h> |
23 #include <hbmessagebox.h> |
24 |
24 |
25 // USER INCLUDES |
25 // USER INCLUDES |
26 #include "ringbc_p.h" |
26 #include "ringbc_p.h" |
27 #include "ringbctoneconverter.h" |
27 #include "ringbctoneconverter.h" |
28 #include "s60qconversions.h" |
28 #include <xqconversions.h> |
29 #include "debugtraces.h" |
29 #include "debugtraces.h" |
30 |
30 |
31 //CONSTANTS |
31 //CONSTANTS |
32 _LIT(KRingingToneFileExtension,".rng"); |
32 _LIT(KRingingToneFileExtension,".rng"); |
33 |
33 |
127 RFs fsSession; |
127 RFs fsSession; |
128 User::LeaveIfError(fsSession.Connect()); |
128 User::LeaveIfError(fsSession.Connect()); |
129 |
129 |
130 CleanupClosePushL(fsSession); |
130 CleanupClosePushL(fsSession); |
131 |
131 |
132 HBufC* fileName = S60QConversions::qStringToS60Desc(path); |
132 HBufC* fileName = XQConversions::qStringToS60Desc(path); |
133 |
133 |
134 RFile file; |
134 RFile file; |
135 User::LeaveIfError(file.Open(fsSession, fileName->Des(), |
135 User::LeaveIfError(file.Open(fsSession, fileName->Des(), |
136 EFileShareReadersOnly)); |
136 EFileShareReadersOnly)); |
137 |
137 |
140 User::LeaveIfError(file.Size(size)); |
140 User::LeaveIfError(file.Size(size)); |
141 |
141 |
142 HBufC8* dataBuf = HBufC8::NewLC(size); |
142 HBufC8* dataBuf = HBufC8::NewLC(size); |
143 TPtr8 data(dataBuf->Des()); |
143 TPtr8 data(dataBuf->Des()); |
144 User::LeaveIfError(file.Read(data, size)); |
144 User::LeaveIfError(file.Read(data, size)); |
145 CleanupStack::PopAndDestroy(&file); |
|
146 |
145 |
147 TBool valid = mConverter->IsRingToneMimeTypeL(data); |
146 TBool valid = mConverter->IsRingToneMimeTypeL(data); |
148 |
147 |
149 if (valid) |
148 if (valid) |
150 { |
149 { |
151 HBufC* title = mConverter->TitleLC(data); |
150 HBufC* title = mConverter->TitleLC(data); |
152 TFileName path = PathInfo::PhoneMemoryRootPath(); |
151 TFileName path = PathInfo::PhoneMemoryRootPath(); |
153 path.Append(PathInfo::SimpleSoundsPath()); |
152 path.Append(PathInfo::SimpleSoundsPath()); |
154 path.Append(*title); |
153 path.Append(*title); |
155 HBufC* fileExtension = S60QConversions::qStringToS60Desc(extension); |
154 HBufC* fileExtension = XQConversions::qStringToS60Desc(extension); |
156 path.Append(fileExtension->Des()); |
155 path.Append(fileExtension->Des()); |
157 |
156 |
158 CFileMan* fileMan = CFileMan::NewL(fsSession); |
157 CFileMan* fileMan = CFileMan::NewL(fsSession); |
159 CleanupStack::PushL(fileMan); |
158 CleanupStack::PushL(fileMan); |
160 if(fileMan) |
159 if(fileMan) |
164 } |
163 } |
165 CleanupStack::PopAndDestroy(2); // title,fileMan |
164 CleanupStack::PopAndDestroy(2); // title,fileMan |
166 } |
165 } |
167 |
166 |
168 CleanupStack::PopAndDestroy(); // dataBuf |
167 CleanupStack::PopAndDestroy(); // dataBuf |
|
168 CleanupStack::PopAndDestroy(); //file |
169 CleanupStack::PopAndDestroy(); //fsSession |
169 CleanupStack::PopAndDestroy(); //fsSession |
170 |
|
171 |
170 |
172 QDEBUG_WRITE("RingBcPrivate::saveToneL : Exit") |
171 QDEBUG_WRITE("RingBcPrivate::saveToneL : Exit") |
173 } |
172 } |
174 |
173 |
175 // ---------------------------------------------------------------------------- |
174 // ---------------------------------------------------------------------------- |
182 |
181 |
183 QString title; |
182 QString title; |
184 QStringList pathList = path.split("."); |
183 QStringList pathList = path.split("."); |
185 QString extension = pathList.at(pathList.count() - 1); |
184 QString extension = pathList.at(pathList.count() - 1); |
186 |
185 |
187 HBufC* fileName = S60QConversions::qStringToS60Desc(path); |
186 HBufC* fileName = XQConversions::qStringToS60Desc(path); |
188 TRAP_IGNORE( title = titleL(*fileName)); |
187 TRAP_IGNORE( title = titleL(*fileName)); |
189 |
188 |
190 title.append(QChar('.')); |
189 title.append(QChar('.')); |
191 title.append(extension); |
190 title.append(extension); |
192 |
191 |
225 |
224 |
226 TBool valid = mConverter->IsRingToneMimeTypeL(data); |
225 TBool valid = mConverter->IsRingToneMimeTypeL(data); |
227 if (valid) |
226 if (valid) |
228 { |
227 { |
229 HBufC* toneTitle = mConverter->TitleLC(data); |
228 HBufC* toneTitle = mConverter->TitleLC(data); |
230 title = S60QConversions::s60DescToQString(*toneTitle); |
229 title = XQConversions::s60DescToQString(*toneTitle); |
231 CleanupStack::PopAndDestroy(); //title |
230 CleanupStack::PopAndDestroy(); //title |
232 } |
231 } |
233 CleanupStack::PopAndDestroy(); //dataBuf |
232 CleanupStack::PopAndDestroy(); //dataBuf |
234 } |
233 } |
235 CleanupStack::PopAndDestroy(); //file |
234 CleanupStack::PopAndDestroy(); //file |